package com.zhentao.controller;

import com.zhentao.pojo.Dept;
import com.zhentao.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Date 2024/4/10 14:47
 * @Author xdm
 **/
@RestController
@RequestMapping("/dept")
public class DeptController {
    @Autowired
    private DeptService deptService;

    /**
     *@RequestBody 要求传递的数据是json格式的
     * 如果没有，是表单提交
     */
    @PostMapping("/add")
    public String add(@RequestBody Dept dept){
        deptService.add(dept);
        return "添加操作";
    }


}
